home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / os2 / wpsec212.zip / CIDINST.CMD < prev    next >
OS/2 REXX Batch file  |  1996-02-17  |  6KB  |  153 lines

  1. /***********************************************************************/
  2. /* CIDINST.CMD Workplace Security CID utility                          */
  3. /*                                                                     */
  4. /*                                                                     */
  5. /*  Function:  Automated Workplace Security Installation               */
  6. /*                                                                     */
  7. /*                                                                     */
  8. /*  Command format: CIDINST action regcode password  "name"            */
  9. /*                                                                     */
  10. /*  Command line options:                                              */
  11. /*                                                                     */
  12. /*   action   = INSTALL,DELETE,UPDATE, or RESTORE (required)           */
  13. /*                                                                     */
  14. /*   regcode  = product registration code (install only)               */
  15. /*                                                                     */
  16. /*   password = Master password of your choice (install only)          */
  17. /*                                                                     */
  18. /*   "name"   =  Name or company that the product is registered to     */
  19. /*               (must be in quotes)                                   */
  20. /*                                                                     */
  21. /*  Example:                                                           */
  22. /*                                                                     */ 
  23. /*     CIDINST INSTALL ABCDEF123456 MASTER "Maple Valley Software"     */
  24. /*                                                                     */
  25. /*  Note: Change the Source_directory and Target_directory             */
  26. /*        as appropriate for your installation.                        */
  27. /*                                                                     */
  28.           Source_directory  = "C:\TEMP" 
  29.           Target_directory  = "D:\WPSECURE"
  30. /*                                                                     */
  31. /*                                                                     */
  32. /* Workplace Security Copyright (C) 1995, 1996 Maple Valley Software   */
  33. /***********************************************************************/
  34.  
  35.  
  36. '@Echo Off'
  37. /* Load REXXUTIL */
  38.  
  39. Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  40. Call SysLoadFuncs
  41.  
  42. /* Initialize */
  43. irc = 0
  44. log_date = insert('-',date('S'),6)
  45. log_date = insert('-',log_date,4)
  46. log_time = substr(time('L'),1,11)   
  47.  
  48. Signal On Failure Name FAILURE
  49. Signal On Halt Name HALT
  50. Signal On Syntax Name SYNTAX
  51.  
  52. parse upper arg install_action regcode password .  
  53. parse arg . . . name
  54.  
  55.  
  56.  
  57. if wordpos(install_action,"INSTALL UPDATE RESTORE DELETE") = 0 then do
  58.      say 'CIDINST action not specified.'
  59.      exit 65280
  60.      end
  61.  
  62. if install_action = "INSTALL" then do
  63.      if regcode = '' then do 
  64.      say 'CIDINST INSTALL requires the registration code and master password.'
  65.      exit 65280
  66.      end
  67.  
  68.      if password = '' then do 
  69.      say 'CIDINST INSTALL requires the registration code and master password.'
  70.      exit 65280
  71.      end
  72.    end
  73.  
  74. /* Build CID install options */
  75. Product_name        = '/P:"Workplace Security"'
  76. Install_Catalog     = "/C:"||Source_directory||"\WPSECURE.ICF"
  77. Install_log         = Target_directory||"\CIDINST.LOG"
  78. Response_file       = Target_directory||"\WPSECURE.RSP"
  79.  
  80. /* Create Target Directory */
  81. Result = SysFileTree( Target_directory, 'Dirs', 'D' )
  82. If Dirs.0 = 0 Then
  83.   Do
  84.   Result = SysMkDir( Target_directory )
  85.   if Result == 0 Then
  86.     Do
  87.     End
  88.   Else
  89.     Do
  90.     Say 'ERROR: Unable to create target directory.'
  91.     Signal DONE
  92.     End
  93.   End
  94.  
  95. Call SysCls
  96.  
  97.  
  98. /* build Response file */
  99.  
  100. call lineout Response_file,,1           /* open the file */ 
  101. call lineout Response_file,"FILE         = "Target_directory 
  102. call lineout Response_file,"WORK         = "Target_directory 
  103. call lineout Response_file,"COMP         = Workplace Security"
  104. call lineout Response_file,"CFGUPDATE    = MANUAL" 
  105. call lineout Response_file,"OVERWRITE    = YES"
  106. call lineout Response_file,"SAVEBACKUP   = YES"
  107. call lineout Response_file,"DELETEBACKUP = NO"
  108. call lineout Response_file              /* close the file */
  109.  
  110. Install_action = translate(install_action)
  111. if install_action = "INSTALL" then Action = "/A:I"
  112. if install_action = "DELETE"  then Action = "/A:D"
  113. if install_action = "UPDATE"  then Action = "/A:U"
  114. if install_action = "RESTORE" then Action = "/A:R"
  115.  
  116. CID_Install_Options = Action "/X /O:DRIVE /S:"||Source_directory " /T:"||Target_directory "/R:"||Response_file "/L1:"||Install_log   
  117.  
  118. call directory(Source_directory)
  119.  
  120. "INSTALL.EXE" Product_name CID_Install_Options Install_Catalog   
  121. irc = rc    /* save return code from installer */
  122. call directory(Target_directory)
  123.  
  124. if install_action = "INSTALL" then do
  125.    'REGISTER.EXE' regcode password name
  126.    rrc = rc 
  127.    log_time = substr(time('L'),1,11)   
  128.    if rrc = 0 then call lineout Install_log, log_date log_time ' Workplace Security Registration complete'
  129.    if rrc = 1 then call lineout Install_log, log_date log_time ' ERROR: Invalid registration code'
  130.    if rrc = 2 then call lineout Install_log, log_date log_time ' ERROR: Invalid registration parameters' 
  131.    if rrc <> 0 then irc = 65280 
  132.    end
  133.  
  134. Signal DONE 
  135.  
  136. FAILURE:
  137. call lineout Install_log, log_date log_time ' REXX failure: Error in CIDINST.CMD'
  138. irc = 65042
  139. Signal DONE
  140.  
  141. HALT:
  142. call lineout Install_log, log_date log_time ' REXX halt: Error in CIDINST.CMD'
  143. irc = 65042
  144. Signal DONE
  145.  
  146. SYNTAX:
  147. call lineout Install_log, log_date log_time ' REXX syntax error: Error in CIDINST.CMD'
  148. irc = 65042
  149. Signal DONE
  150.  
  151. DONE:
  152. Exit irc
  153.